#include "common.h"
#include "GameRoot.h"
#include "SimpleAudioEngine.h"

unsigned int get_current_msec ()
{
	struct tm *tm;
	time_t timep;

	struct cc_timeval now; 
	CCTime::gettimeofdayCocos2d(&now, NULL); 
	timep = now.tv_sec*1000+now.tv_usec/1000;


	return (unsigned int)timep;
}

const char* G2U(const char* gb2312)  
{  

#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) 

	int len = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);  
	wchar_t* wstr = new wchar_t[len+1];  
	memset(wstr, 0, len+1);  
	MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wstr, len);  
	len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);  
	char* str = new char[len+1];  
	memset(str, 0, len+1);  
	WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);  
	if(wstr) delete[] wstr;  
	return str;  
#endif

	return gb2312;
} 

void PlayEffect( const char * pszMusic )
{
	if (GameRoot::getDataManager()->getMusicStatus())
	{
		CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(pszMusic);
	}
	
}
